home *** CD-ROM | disk | FTP | other *** search
- import java.util.Calendar;
- import java.util.Timer;
- import java.util.TimerTask;
- import javax.microedition.lcdui.Canvas;
- import javax.microedition.lcdui.Font;
- import javax.microedition.lcdui.Graphics;
-
- class CompassCanvas extends Canvas {
- Compass parent;
- Timer timer;
- // $FF: renamed from: x long[]
- static final long[] field_0 = new long[]{0L, 26L, 52L, 78L, 104L, 130L, 156L, 182L, 207L, 233L, 258L, 284L, 309L, 333L, 358L, 382L, 406L, 430L, 453L, 477L, 499L, 522L, 544L, 566L, 587L, 608L, 629L, 649L, 669L, 688L, 707L, 725L, 743L, 760L, 777L, 793L, 809L, 824L, 838L, 852L, 866L, 878L, 891L, 902L, 913L, 923L, 933L, 942L, 951L, 958L, 965L, 972L, 978L, 983L, 987L, 991L, 994L, 996L, 998L, 999L, 1000L, 999L, 998L, 996L, 994L, 991L, 987L, 983L, 978L, 972L, 965L, 958L, 951L, 942L, 933L, 923L, 913L, 902L, 891L, 878L, 866L, 852L, 838L, 824L, 809L, 793L, 777L, 760L, 743L, 725L, 707L, 688L, 669L, 649L, 629L, 608L, 587L, 566L, 544L, 522L, 499L, 477L, 453L, 430L, 406L, 382L, 358L, 333L, 309L, 284L, 258L, 233L, 207L, 182L, 156L, 130L, 104L, 78L, 52L, 26L};
- // $FF: renamed from: y long[]
- static final long[] field_1 = new long[]{1000L, 999L, 998L, 996L, 994L, 991L, 987L, 983L, 978L, 972L, 965L, 958L, 951L, 942L, 933L, 923L, 913L, 902L, 891L, 878L, 866L, 852L, 838L, 824L, 809L, 793L, 777L, 760L, 743L, 725L, 707L, 688L, 669L, 649L, 629L, 608L, 587L, 566L, 544L, 522L, 500L, 477L, 453L, 430L, 406L, 382L, 358L, 333L, 309L, 284L, 258L, 233L, 207L, 182L, 156L, 130L, 104L, 78L, 52L, 26L, 0L, -26L, -52L, -78L, -104L, -130L, -156L, -182L, -207L, -233L, -258L, -284L, -309L, -333L, -358L, -382L, -406L, -430L, -453L, -477L, -499L, -522L, -544L, -566L, -587L, -608L, -629L, -649L, -669L, -688L, -707L, -725L, -743L, -760L, -777L, -793L, -809L, -824L, -838L, -852L, -866L, -878L, -891L, -902L, -913L, -923L, -933L, -942L, -951L, -958L, -965L, -972L, -978L, -983L, -987L, -991L, -994L, -996L, -998L, -999L};
-
- CompassCanvas(Compass parent) {
- this.parent = parent;
- TimerTask timerTask = new CompassCanvas$1(this);
- this.timer = new Timer();
- this.timer.schedule(timerTask, 60000L, 60000L);
- }
-
- public void paint(Graphics g) {
- g.setColor(16777215);
- g.fillRect(0, 0, ((Canvas)this).getWidth(), ((Canvas)this).getHeight());
- g.setColor(0);
- Calendar now = Calendar.getInstance();
- int h = now.get(10);
- int m = now.get(12);
- int table_index = (h - 1) * 10 + m / 6;
- if (!this.parent.daylightSaving) {
- table_index += 10;
- }
-
- if (table_index > 119) {
- table_index -= 120;
- }
-
- g.setFont(Font.getFont(0, 0, 8));
- int N_height = g.getFont().getHeight();
- int N_margin = 2;
- int line_length = ((Canvas)this).getHeight() / 2 - N_height - 2;
- if (line_length >= 0) {
- int centre_x = ((Canvas)this).getWidth() / 2;
- int centre_y = ((Canvas)this).getHeight() / 2;
- int a = (int)((long)line_length * field_0[table_index] / 1000L);
- int b = (int)((long)line_length * field_1[table_index] / 1000L);
- if (now.get(11) - (this.parent.daylightSaving ? 1 : 0) < 12) {
- a *= -1;
- b *= -1;
- }
-
- if (!this.parent.northern) {
- b *= -1;
- }
-
- int north_x = centre_x + a;
- int north_y = centre_y + b;
- int south_x = centre_x - a;
- int south_y = centre_y - b;
- int east_x = centre_x + b;
- int east_y = centre_y - a;
- int west_x = centre_x - b;
- int west_y = centre_y + a;
- g.drawLine(south_x, south_y, north_x, north_y);
- g.drawLine(east_x, east_y, west_x, west_y);
- int N_char_y = north_y > centre_y ? north_y + 2 : north_y - N_height - 2;
- g.drawChar('N', north_x, N_char_y, 16 | 1);
- }
- }
- }
-